package com.client.view;

/**
 * Created by Administrator on 2016/12/18.
 */
import com.client.bean.UserInfo;
import com.client.db.UserDbOper;

import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.InetAddress;

/**
 * Created by Administrator on 2016/12/16.
 */
public class LookUser extends JFrame implements ActionListener{
	private UserInfo userInfo;
	private JLabel bgimage;

	private  JButton btnSave,btnClose;


	public LookUser() {
		init();
	}

	public LookUser(UserInfo userInfo){
		this.userInfo = userInfo;
		init();
	}

	public void init() {

		try {
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch (Exception e) {
			e.printStackTrace();
		}

		Icon bg_img=new ImageIcon("images/main_back.jpg");
		bgimage=new JLabel(bg_img);
		add(bgimage);
		JLabel lblTitle = new JLabel("个人资料");
		lblTitle.setFont(new Font("华文新魏",Font.BOLD,28));
		lblTitle.setBounds(150,30,150,40);
		bgimage.add(lblTitle);
		bgimage.setBorder(BorderFactory.createBevelBorder(2));
		int i = 0;



		JLabel lblface = new JLabel(new ImageIcon(userInfo.getFace()));
		lblface.setBounds(270,70,80,80);

		bgimage.add(lblface);


		JLabel lblchatcode = new JLabel("帐号: " + userInfo.getCode() , JLabel.RIGHT);
		JLabel lblnickName = new JLabel("昵称: " + userInfo.getNicknName() , JLabel.RIGHT);
		JLabel lblage = new JLabel("年龄: " + userInfo.getAge() , JLabel.RIGHT);
		JLabel lblsex = new JLabel("性别: " + userInfo.getSex() , JLabel.RIGHT);
		JLabel lblnation= new JLabel("民族: " + userInfo.getNation() , JLabel.RIGHT);
		JLabel lblstar= new JLabel("星座: " + userInfo.getStar() , JLabel.RIGHT);
		JLabel lblremark= new JLabel("备注: " + userInfo.getRemark() , JLabel.RIGHT);
		JLabel lblinformation = new JLabel("信息: " + userInfo.getInformation() , JLabel.RIGHT);


		lblchatcode.setBounds(50,70,160,25);

		bgimage.add(lblchatcode);



		lblnickName.setBounds(50,110,160,25);

		bgimage.add(lblnickName);



//		lblpassword.setBounds(50,150,60,25);
//		lblfgpassword.setBounds(270,150,60,25);
//
//		bgimage.add(lblpassword);
//
//		bgimage.add(lblfgpassword);
//
//
//
//		lblipAddr.setBounds(50,190,60,30);
//
//		bgimage.add(lblipAddr);
//
//
//
//		lblport.setBounds(270,190,60,25);
//
//		bgimage.add(lblport);



		lblage.setBounds(50,230,160,25);

		bgimage.add(lblage);



		lblsex.setBounds(270,230,160,25);

		ButtonGroup bg = new ButtonGroup();

		bgimage.add(lblsex);



		lblnation.setBounds(50,270,160,25);

		bgimage.add(lblnation);



		lblstar.setBounds(270,270,160,25);

		bgimage.add(lblstar);



		lblremark.setBounds(50,310,160,25);
		bgimage.add(lblremark);


		lblinformation.setBounds(50,350,160,25);
//		JScrollPane spanel = new JScrollPane(information);
//		spanel.setBounds(110,350,320,80);
		bgimage.add(lblinformation);
//		bgimage.add(spanel);

//		btnSave = new JButton("保存");
		btnClose = new JButton("关闭");
//		btnSave.setBounds(150,450,80,30);
		btnClose.setBounds(230,450,80,30);
//		bgimage.add(btnSave);
		bgimage.add(btnClose);
//		btnSave.addActionListener(this);
		btnClose.addActionListener(this);

		setResizable(false);
		setSize(500, 600);
		setVisible(true);
		setLocationRelativeTo(null);
//		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

	}

	public static void main(String[] args) {
		new RegUser();
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == btnClose) {
//			System.exit(0);
			dispose();
		}
	}
}
